package com.esl.action.admin;

import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.esl.action.CommonAction;
import com.esl.dto.admin.Info_Dto;
import com.esl.service.admin.InfoManager;

//@Controller
@Result(name = "tolist", location = "info?jump_url=list", type = "redirect")
public class InfoAction extends CommonAction {
	private Info_Dto info_Dto = new Info_Dto();
	private InfoManager infoManager;
	private Map<String, Object> session = getSession();

	public String add() {
		infoManager.add(info_Dto.toInfo());
		return "tolist";
	}

	public String load() {
		setPageInfo_Dto(infoManager.load(1, 5, "", ""));
		return "success";
	}

	/*--------------------------------*/
	public void setInfo_Dto(Info_Dto info_Dto) {
		this.info_Dto = info_Dto;
	}

	public Info_Dto getInfo_Dto() {
		return info_Dto;
	}

	/*--------------------------------*/
	@Resource
	public void setInfoManager(InfoManager infoManager) {
		this.infoManager = infoManager;
	}

	@Resource
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}
}
